import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmgResourceVO, EmgResourceForm, EmgResourceQuery } from '@/api/biz/emgResource/types';

/**
 * 查询应急资源组织列表
 * @param query
 * @returns {*}
 */

export const listEmgResource = (query?: EmgResourceQuery): AxiosPromise<EmgResourceVO[]> => {
  return request({
    url: '/biz/emgResource/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询应急资源组织详细
 * @param id
 */
export const getEmgResource = (id: string | number): AxiosPromise<EmgResourceVO> => {
  return request({
    url: '/biz/emgResource/' + id,
    method: 'get'
  });
};

/**
 * 新增应急资源组织
 * @param data
 */
export const addEmgResource = (data: EmgResourceForm) => {
  return request({
    url: '/biz/emgResource',
    method: 'post',
    data: data
  });
};

/**
 * 修改应急资源组织
 * @param data
 */
export const updateEmgResource = (data: EmgResourceForm) => {
  return request({
    url: '/biz/emgResource',
    method: 'put',
    data: data
  });
};

/**
 * 删除应急资源组织
 * @param id
 */
export const delEmgResource = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/emgResource/' + id,
    method: 'delete'
  });
};
